#include "scutable.h"

typedef struct target_s
{
  struct target_s *derives;
  char *name;
  char *skeletondir;
  char *address;
  
  table_t resources;  /* target_resource_t, owned, name hashed */
  table_t operations; /* target_operation_t, referenced, by opid */
} target_t;

typedef struct target_resource_s
{
  char *name;
  double count;
  int shareable;

  struct target_s *target;
} target_resource_t;

typedef struct operation_s
{
  char *name;
  int id;
  char *skeleton;
  char *kernel;
  int line;

  table_t arguments; /* operation_argument_t, owned */
  table_t targets;   /* target_operation_t, referenced */
} operation_t;

typedef struct operation_argument_s
{
  int id;
  char *name;
  char *datatype;
  int type;
  int intent;
  int sizeoftype;

  struct operation_s *operation;
} operation_argument_t;

typedef struct target_operation_s
{
  double affinity;
  int delay;

  table_t arguments; /* target_operation_argument_t, owned */
  table_t resources; /* target_operation_resource_t, owned */

  struct target_s *target;
  struct operation_s *operation;  
} target_operation_t;

typedef struct target_operation_argument_s
{
  double bandwidth;
  int state;
  int chunksize;

  struct operation_argument_s *operation_argument;
  struct target_operation_s *target_operation;
} target_operation_argument_t;

typedef struct target_operation_resource_s
{  
  double count;

  struct target_resource_s *target_resource;
  struct target_operation_s *target_operation;
} target_operation_resource_t;

typedef struct link_s
{
  char *name;
  target_t *source, *destination;
} link_t;
